<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文件</title>
    <link rel="stylesheet" href="/static/style.css">
    <script>
        function opensub() {
            location.href = '/?root=' + window.event.target.dataset.path;
        }
    </script>
</head>
<body>
    <table>
        <tr>
            <th>名称</th>
            <th>大小</th>
            <th>操作</th>
        </tr>
        {% for item in items %}
        <tr>
            <td>{{ item.name }}</td>
            <td>{{ item.size|filesizeformat }}</td>
            {% if item.is_dir %}
            <td><button onclick="opensub()" data-path="{{item.path}}">打开</button></td>
            {% else %}
            <td></td>
            {% endif %}
        </tr>
        {% endfor %}
    </table>
</body>
</html>
